/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package br.com.hugo.senai.entities;


import java.io.Serializable;
import java.util.Collection;
import javax.persistence.*;
import static javax.persistence.CascadeType.ALL;
import static javax.persistence.FetchType.LAZY;

/**
 *
 * @author alunoo
 */
@Entity
public class Curso implements Serializable {
    
    @Id@GeneratedValue
    private int id;
    
    @OneToMany(mappedBy = "curso", fetch = LAZY, cascade = ALL)
    Collection <Disciplina> materia;
    
    @Column(unique = true, nullable = false )
    private String nome;
    private int cargaHoraria;
    @Lob
    private String descricao;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public Collection<Disciplina> getMateria() {
        return materia;
    }

    public void setMateria(Collection<Disciplina> materia) {
        this.materia = materia;
    }

    public String getNome() {
        return nome;
    }

    public void setNome(String nome) {
        this.nome = nome;
    }

    public int getCargaHoraria() {
        return cargaHoraria;
    }

    public void setCargaHoraria(int cargaHoraria) {
        this.cargaHoraria = cargaHoraria;
    }

    public String getDescricao() {
        return descricao;
    }

    public void setDescricao(String descricao) {
        this.descricao = descricao;
    }
    
    @Override
    public String toString(){
        return nome;
    }
    
   
    
}
